import request from '@/utils/request'

const getExhibitList = (page, limit, key) => {
  return request('/exhibits/list', {
    method: 'get',
    params: {
      page,
      limit,
      key
    }
  })
}

const getExhibitListByFuzzyQuery = (page, limit, key) => {
  return request('/exhibits/listByFuzzyQuery', {
    method: 'get',
    params: {
      page,
      limit,
      key
    }
  })
}

const deleteExhibitList = (exhibitIds) => {
  return request('/exhibits/delete', {
    method: 'post',
    data: {
      exhibitIds
    }
  })
}

const getExhibitById = (exhibitId) => {
  return request({
    url: `/exhibits/info/${exhibitId}`,
    method: 'get'
  })
}

const saveOrUpdateExhibit = (exhibitId, exhibit) => {
  return request(`/exhibits/${!exhibitId ? 'save' : 'update'}`, {
    method: 'post',
    data: exhibit
  })
}

export { getExhibitList, getExhibitListByFuzzyQuery, deleteExhibitList, getExhibitById, saveOrUpdateExhibit }
